﻿namespace EyeOpen.Security.Mvc
{
	using System.Web.Mvc;

	using EyeOpen.Data;
	using EyeOpen.Security.Data;
	using EyeOpen.Security.Mvc.Controllers;
	using EyeOpen.Web.Mvc;

	public class SecurityDependencyResolver
		: DependencyResolverBase
	{
		public override object GetService(System.Type serviceType)
		{
			if (serviceType == typeof(SecurityController))
			{
				return
					new SecurityController(DependencyResolver.Current.GetService<ISecurityUnitOfWork>());
			}

			if (serviceType == typeof(ISecurityUnitOfWork))
			{
				return
					new SecurityUnitOfWork(DbProviders.SqlCe, "DataSource = |DataDirectory|Security.sdf");
			}

			return null;
		}
	}
}